%%% -------------------------------------------------------------------
%%% Author  : carl
%%% Description :
%%%
%%% Created : 31 May 2011
%%% -------------------------------------------------------------------
-module(node8583_sup).

-behaviour(supervisor).
%% --------------------------------------------------------------------
%% Include files
%% --------------------------------------------------------------------

%% --------------------------------------------------------------------
%% External exports
%% --------------------------------------------------------------------
-export([start_link/1, start_child/0]).

%% --------------------------------------------------------------------
%% Internal exports
%% --------------------------------------------------------------------
-export([
	 init/1
        ]).

%% --------------------------------------------------------------------
%% Macros
%% --------------------------------------------------------------------
-define(SERVER, ?MODULE).

%% --------------------------------------------------------------------
%% Records
%% --------------------------------------------------------------------

%% ====================================================================
%% External functions
%% ====================================================================
start_link(LSock) ->
	supervisor:start_link({local, ?SERVER}, ?MODULE, [LSock]).

start_child() ->
	supervisor:start_child(?SERVER, []).

%% ====================================================================
%% Server functions
%% ====================================================================
%% --------------------------------------------------------------------
%% Func: init/1
%% Returns: {ok,  {SupFlags,  [ChildSpec]}} |
%%          ignore                          |
%%          {error, Reason}
%% --------------------------------------------------------------------
init([LSock]) ->
	Server = {node8583_server, {node8583_server, start_link, [LSock]},
			  temporary, brutal_kill, worker, [node8583_server]},
    Children = [Server],
	RestartStrategy = {simple_one_for_one, 0, 1},
    {ok, {RestartStrategy, Children}}.

%% ====================================================================
%% Internal functions
%% ====================================================================

